<%@page import="models.GeoModel"%>
<%@page import="admin.data.GeoData"%>
<%@page import="models.ProfitBySaler"%>
<%@page import="java.util.Locale"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.List"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%	
	List<ProfitBySaler> list = (List<ProfitBySaler>)request.getAttribute("result");	
	NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN);
	String fromDate = "";
	String toDate = "";	
	String city = "";
	if(request.getAttribute("city")!=null&&!request.getAttribute("city").toString().isEmpty()){
		city = (String)request.getAttribute("city");		
	}	
	if(request.getAttribute("fromDate")!=null&&!request.getAttribute("fromDate").toString().isEmpty()){
		fromDate = (String)request.getAttribute("fromDate");		
	}
	if(request.getAttribute("toDate")!=null&&!request.getAttribute("toDate").toString().isEmpty()){
		toDate = (String)request.getAttribute("toDate");		
	}
	GeoData geoData = new GeoData();
	GeoModel currentCity;
	if(city!=null&&!city.isEmpty()){
		currentCity= geoData.getGeo(city);
	}else{
		currentCity = geoData.getFirstCity();
	}

%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Báo Cáo Doanh Số Chi Tiết <%=(fromDate!=null&&!fromDate.isEmpty())?"Từ Ngày "+fromDate:""%><%=(toDate!=null&&!toDate.isEmpty())?" Đến Ngày "+toDate:""%></title>
<link rel="stylesheet" type="text/css" href="/css/simple-style.css" />
</head>
<body>
     <div class="simpleStyle">
    	<table cellpadding="0" cellspacing="0" class="simpleTable">
        	<thead>
            	<tr>
                	 <th class="head1">STT</th>
                     <th class="head0">Saler</th>
                     <th class="head1">Display GP</th>
                     <th class="head0">Real GP</th>
                     <th class="head1">Rate</th>	      
                </tr>
            </thead>
            <tbody>
            	<%
                 	if(list!=null&&list.size()>0){
                 		for(int i = 0; i< list.size();i++){
                 %>                    	
                     <tr>	                        	
						 <td class="center"><%=i+1%></td>
                         <td class="center"><%=list.get(i).getSalername()%></td>
                         <td class="center"><%=nf.format(list.get(i).getDisplayGP())%></td>
                         <td class="center"><%=nf.format(list.get(i).getRealGP())%></td>
                         <td class="center"><%=nf.format(list.get(i).getRate())%></td>	                                           
                     </tr>	 
                  <%
               		}
              		}
                  %>     
            </tbody>
        </table>
    </div>     
</body>
</html>